﻿<Button @onclick="@OnClickParameter">Dialog 传参示例</Button>

@code {
    /// <summary>
    /// 
    /// </summary>
    /// <returns></returns>
    private Task OnClickParameter()
    {
        DialogService?.Show(new DialogOption()
        {
            Title = "自带的 Counter 组件",
            BodyContext = "我是传参",
            BodyTemplate = builder =>
            {
                var index = 0;
                builder.OpenComponent<DemoComponent>(index++);
                builder.CloseComponent();
            }
        });
        return Task.CompletedTask;
    }
}

DemoComponent 代码
@code {
    <div>@Parameter</div>

    @code {
        [CascadingParameter(Name = "BodyContext")]
        private object? Parameter { get; set; }
    }
}
